<template>
  <div>
    <p>{{ title }}</p>
    <p v-for="item in user" :key="item">{{ item }}</p>
    <p>{{ msg }}</p>
    <!-- 自定义的button 子传父 -->
    <button @click="$emit('sonEmit',1,'string',{name:'小强'})">emit触发父组件绑定子组件上的函数</button>
  </div>
</template>

<script lang="ts">
export default {
  name: 'daySonDemo39',
};
</script>

<script lang="ts" setup>
import { ref } from 'vue';
export interface Iuser {
  id?:number
  name: string;
  age: number;
  sex: string;
}
//响应式Props解构 3.5
const {
  title = ref('江山如此多娇'),
  user,
  msg,
} = defineProps<{
  title?: string;
  user: Iuser;
  msg?: string;
}>();
console.log(title, user, msg);
</script>
